<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="comm.util.RequestManager"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.io.File"%>    
<%@page import="comm.util.QuikHashMap"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Quik - Enterprise Microblogging</title>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/global.css"/>
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.3.2.min.js"></script>  
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
	</head>
<%
	
	QuikHashMap hm = RequestManager.getRequest(request);
	//디렉토리 목록을 ArrayList에 넣는다.
	
	File jspDir = new File(request.getRealPath("/jsp/"));
	String[] contentsDir = jspDir.list();
	Boolean existDir = false;
	
	
	String content = null;
	System.out.println(hm.get("CONTENT"));
	if(hm.get("CONTENT") == null || hm.get("CONTENT").toString().length() < 1){
		content =  "../main/index.jsp";
	}else{
		for(int i = 0; i<contentsDir.length ; i++){
			if(hm.get("CONTENT").toString().equals(contentsDir[i])){
					content =  "../"+hm.get("CONTENT").toString() + "/index.jsp";	
				existDir = true;
			}
		}
		if(!existDir){
			content = "../../error/404.jsp";
		}
	}
%>
	<body>
		<div id="wrapper">
			<div id="headerWrapper">
				<%@include file="./header.jsp" %>
			</div>
			<div id="bodyWrapper">
				<jsp:include page="<%=content%>" flush="false"></jsp:include>
			</div>
			<div id="footerWrapper">
				<%@include file="./footer.jsp" %>
			</div>
		</div>
	</body>
</html>